import request from "@/utils/request";

// 查询菜单列表
export function listMenu (query) {
  return request({
    url: "/v1/system/menu/list",
    method: "get",
    params: query,
  });
}

// 查询菜单详细
export function getMenu (menu_id) {
  return request({
    url: "/v1/system/menu/getById",
    method: "get",
    params: { menu_id },
  });
}

// 查询菜单下拉树结构
export function treeselect () {
  return request({
    url: "/v1/system/menu/treeselect",
    method: "post",
  });
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect (role_id) {
  return request({
    url: "/v1/system/menu/roleMenuTreeselect",
    method: "post",
    data: { role_id }
  });
}

// 新增菜单
export function addMenu (data) {
  return request({
    url: "/v1/system/menu/add",
    method: "post",
    data: data,
  });
}

// 修改菜单
export function updateMenu (data) {
  return request({
    url: "/v1/system/menu/update",
    method: "put",
    data: data,
  });
}

// 删除菜单
export function delMenu (menu_id) {
  return request({
    url: "/v1/system/menu/delete",
    method: "post",
    data: { menu_id }
  });
}
